package com.dididoctor.doctor.Dialog.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.dididoctor.doctor.R;

import java.util.List;


public class SimpleListDialogAdapter extends BaseArrayListAdapter {

    private String[] currents;

    public SimpleListDialogAdapter(Context context, List<String> datas) {
        super(context, datas);
    }

    /**
     * @param context       上下文
     * @param currentString 当前text
     * @param datas         数组
     */
    public SimpleListDialogAdapter(Context context, String currentString,
                                   boolean isShow, String... datas) {
        super(context, currentString, isShow, datas);
    }

    public SimpleListDialogAdapter(Context context, String... datas) {
        super(context, datas);
    }

    @Override
    public View getView(int arg0, View arg1, ViewGroup arg2) {
        if (arg1 == null) {
            arg1 = mInflater.inflate(R.layout.listitem_dialog, null);
        }
        ((HandyTextView) arg1.findViewById(R.id.listitem_dialog_text))
                .setText((CharSequence) getItem(arg0));
        ImageView currentIcon = (ImageView) arg1
                .findViewById(R.id.listitem_dialog_icon);
        if (getItem(arg0).toString().equals(currentString)) {
            currentIcon.setVisibility(View.VISIBLE);
        } else {
            currentIcon.setVisibility(View.GONE);
        }
        return arg1;

    }
}